use super::schema::posts;

#[derive(Queryable)]
#[table_name="posts"]
pub struct Post {
    pub id: String,
    pub catId: String,
    pub authorId: String,
    pub title: String,
    pub body: String,
    pub published: bool,
    pub created_at: Date,
    pub updated_at: Date
}

#[derive(Insertable)]
#[table_name="posts"]
pub struct NewPost<'a> {
    pub cat_id: &'a str,
    pub title: &'a str,
    pub body: &'a str,
    pub author_id: &'a str,
    pub create_at: &'a str,
    pub update_at: &'a str,
}

#[derive(Updatable)]
#[table_name="posts"]
pub struct EditPost<'a> {
    pub cat_id: &'a str,
    pub title: &'a str,
    pub body: &'a str,
    pub update_at: &'a str,
}